public class CarTest {
    public static void main(String[] args) {
        Car car1=new Car("mazida","kkk","white");
        System.out.println(car1);
        Car car2=new Car("gelly","jili","white");
        System.out.println(car2);
        Car car3=new Car("BYD","xiaoyun","black");
        System.out.println(car3);
        System.out.println("汽车销量："+Car.salesCount);
    }
}

class Car{
    private String brand;
    private String moto;
    private String white;

//    salesCount销量
    public static int salesCount;
    public Car(String brand,String moto,String white){
        this.brand=brand;
        this.moto=moto;
        this.white=white;
    }

    public String getWhite() {
        return white;
    }

    public void setWhite(String white) {
        this.white = white;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getMoto() {
        return moto;
    }

    public void setMoto(String moto) {
        this.moto = moto;
    }

    @Override
    public String toString() {
        salesCount++;
        return "Car{" +
                "brand='" + brand + '\'' +
                ", moto='" + moto + '\'' +
                ", white='" + white + '\'' +
                '}';
    }
}
